package com.example.demo.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.demo.common.S;
import com.example.demo.entity.Orders;
import com.example.demo.service.OrdersService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.security.PrivateKey;

@Slf4j
@RestController
@RequestMapping("/order")
public class OrdersController {
    @Autowired
    private OrdersService ordersService;
    //用户下单
    @PostMapping("/submit")
    public S<String> submit(@RequestBody Orders orders){
        ordersService.submit(orders);
        return S.success("下单成功");
    }
    @GetMapping("/page")
    public S<Page<Orders>> page(int page,int pageSize){
        Page page1=new Page(page,pageSize);
//        LambdaQueryWrapper<Orders> lambdaQueryWrapper=new LambdaQueryWrapper();
//        lambdaQueryWrapper.eq()
        ordersService.page(page1);
        return S.success(page1);
    }
}
